package top.luckyluxcis.api;

import lombok.experimental.UtilityClass;
import top.luckyluxcis.RollApi;
import top.luckyluxcis.type.Weather;
import top.luckyluxcis.util.MapUtil;

/**
 * 全国天气信息查询，定时更新天气
 *
 * @author Zhuang
 * @since 2023/9/21
 */
@SuppressWarnings("unused")
@UtilityClass
public class WeatherUtil {
    private static final RollApi API = RollApi.getInstance();

    /**
     * 获取特定城市今日天气信息
     *
     * @param city 传入你需要查询的城市，请尽量传入完整值，否则系统会自行匹配，可能会有误差
     * @return {@link Weather}
     */
    public static Weather current(String city) {
        return API.get("/weather/current/" + city, MapUtil.empty(), Weather.class);
    }

    /**
     * 获取特定城市今天及未来天气信息
     *
     * @param city 传入你需要查询的城市，请尽量传入完整值，否则系统会自行匹配，可能会有误差
     * @return {@link Weather}
     */
    public static Weather forecast(String city) {
        return API.get("/weather/forecast/" + city, MapUtil.empty(), Weather.class);
    }
}
